import request from "@/utils/request";
//获得列表
export const getHouse = () => request.get('/houses')

//获得轮播图列表
export const getPic = () => request.get('/home/swiper')

//获得租房小组
export const getGroups = () => request.get('/home/groups')

//获得城市列表
export const getList = () => request.get('/area/city', { params: { level: 1 }, })

//获得热门城市
export const getHot = () => request.get('/area/hot')

//获得房屋具体信息
export const getHouseInfo = (id) => request.get(`/houses/${id}`,)

//查看房屋列表
export const getCollectList = () => request.get(`/user/favorites`)
//查看房屋是否收藏
export const getCollectHouse = (id) => request.get(`/user/favorites/${id}`)

//添加收藏房屋
export const addCollectList = (id) => request.post(`/user/favorites/${id}`)

//删除收藏房屋
export const subCollectList = (id) => request.delete (`/user/favorites/${id}`)

//获取房屋查询条件
export const cityAreaHouse = (id) => request.get(`/houses/condition`, { params: { id } }) 

//查询房屋发布条件
export const rentHouseCondition = () => request.get('/houses/params')

//查询小区
export const getCommunity = (name, ctid) => request.get(`/area/community?name=${name}&id=${ctid}`)

//发布房源
export const rentHouseGo = (data) => request.post('/user/houses',data)

//上传图片
export const rentHouseImage = (data) => request({
  url: '/houses/image',
  method:'POST',
  data,
  header: { 'Content-Type': 'multipart/form-data' }
})
  
//查看已发布房屋
export const lookRentHouse = () => request.get('/user/houses')

//地图找房
export const mapHouse = (id) => request.get(`/area/map?id=${id}`)

//获得地区房屋列表
export const getAreaHouseList = (id) => request.get(`/houses?cityId=${id}`)
